capture	log close
log using MAR04-ModModels-UNODC,  replace text

//  program:    Stata 
//  task:       Sample and diagnostics 
//  project:    Markets  

version
clear all
macro drop _all
set linesize 80
set more off
local tag " 06-06-24| Cleaned 06-06-24"
local file  "MAR04-ModModels-UNODC"
local note "|`tag' | `file'"
local opt "noparen sideway excel noaster  bdec(2)  sdec(2)  pdec(3)   adec(2) e(r2) stats(coef se pval)"
local dv "lrhom_un"
local iv "fraser"
local iv2 "infantmort" 
local cont "edu unemp  popdense perurban  sexratio"

//	#0
//	loading data 
use MAR03-MedModel-UNODC.dta, clear 

//	#1
//	Moderating Model fraser X infant  
xtreg lrhom_un c.`iv'##c.infant `cont', fe vce(cluster CID) 
outreg2 using `file', replace `opt'  ctitle(Fraser X infant)
//	#2
//	Moderating hertiage X infant 
xtreg lrhom_un c.heritage##c.infant `cont', fe vce(cluster CID) 
outreg2 using `file', append `opt' ctitle(hertiage X infant)
//	#3
//	Moderating ROL X infant 
xtreg lrhom_un c.rol##c.infant `cont', fe vce(cluster CID) 
outreg2 using `file', append `opt' ctitle(rol X infant)

//	#4
//	GDP set up 
* qladder gdp 
gen lgdp=log(gdp)
label var lgdp "Ln GDP per capita"

//	#5
//	Moderating GDP 
xtreg `dv' c.fraser##c.lgdp `iv2' `cont', fe vce(cluster CID)
outreg2 using `file', append `opt' ctitle(faser X lgdp)

xtreg `dv' c.heritage##c.lgdp `iv2' `cont', fe vce(cluster CID)
outreg2 using `file', append `opt' ctitle(heritage X lgdp)

xtreg `dv' c.rol##c.lgdp `iv2' `cont', fe vce(cluster CID)
outreg2 using `file', append `opt' ctitle(rol X lgdp)

//	#6
//	INfant and GDP mods together
xtreg `dv' c.fraser##c.lgdp c.fraser##c.`iv2' `cont', fe vce(cluster CID)
outreg2 using `file', append `opt' ctitle(fraser X lgdp fraserX`iv2')
qui reg `dv' c.fraser##c.lgdp c.fraser##c.`iv2' `cont', vce(cluster CID)
vif

xtreg `dv' c.heritage##c.lgdp c.heritage##c.`iv2' `cont', fe vce(cluster CID)
outreg2 using `file', append `opt' ctitle(heritage X lgdp heritage`iv2')

qui reg `dv' c.heritage##c.lgdp c.heritage##c.`iv2' `cont', vce(cluster CID)
vif 

xtreg `dv' c.rol##c.lgdp c.rol##c.`iv2' `cont', fe vce(cluster CID)
outreg2 using `file', append `opt' title(rol X lgdp rol`iv2')
qui reg `dv' c.rol##c.lgdp c.rol##c.`iv2' `cont', vce(cluster CID)
vif 

//	#7
//	save and close
note:  Moderating models | `note'.
notes
save `file'.dta, replace 
log close 
//

